#ifndef ELEMENT3D_H
#define ELEMENT3D_H

#include "AReVi/arObject.h"
#include "AReVi/Lib3D/object3D.h"
using namespace AReVi;

#include "element.h"

/** An element with a 3D representation */
class Element3D : public Element {
public:
    AR_CLASS(Element3D)
    /*  Unable to differenciate local and distant object 
     *  Local by default */
    AR_CONSTRUCTOR(Element3D)
    
    /** 3D Representation handling */
    inline virtual ArRef<Object3D> getRepresentation(void) const { return _representation; }

    /** Initialise element. Must be done after calling constructor.
     *  Can be used to differenciate local and distant elements */
    virtual void init();

protected:
    /** Write Element configuration to stream */
    virtual void writeConfiguration(ArRef<AbstractOStream> oStream);
    /** Read Element configuration to stream */
    virtual void readConfiguration(ArRef<AbstractIStream> iStream);

    /** Write Element configuration to stream */
    virtual void writeUpdate(ArRef<AbstractOStream> oStream);
    /** Read Element configuration to stream */
    virtual void readUpdate(ArRef<AbstractIStream> iStream);

    /** A motion callback */
    void _onMotionCB(const Base3D::MotionEvent & evt);

    /** Visual representation */
    ArRef<Object3D> _representation;
};

#endif
